package cn.micai.base.string;

/**
 * 描述：如何检查一个字符串是否是java中另一个字符串的旋转
 * <p>
 *
 * @author: 赵新国
 * @date: 2018/6/11 15:11
 */
public class StringRotationMain {

    public static void main(String [] args) {

        System.out.println("java2blog and blogjava2 are rotation of each other : "+isRotation("java2blog","blogjava2"));
        System.out.println("java2blog and avablog2j are rotation of each other : "+isRotation("java2blog","avablog2j"));
    }

    public static boolean isRotation(String str, String rotation) {
        String str2 = str + str;
        if (str2.contains(rotation)) {
            return true;
        }
        return false;
    }
}
